#define _CRT_SECURE_NO_WARNINGS


#include<stdio.h>
int main()
{
	int n;
	int m;
	int h = 0;
	int a[100];
	int g = 0;
	scanf("%d", &n);
	m = n;
	while (m)
	{
		m  /= 10;
		h++;
	}
	printf("%d\n", h);
	m = n;
	while (m)
	{
		a[g] = m % 10;
		g++;
		m /= 10;
	}
	for (h =g-1; h>=0; h--)
	{
		printf("%d ", a[h]);
	}
	printf("\n");
	for (h = 0; h < g; h++)
	{
		printf("%d ", a[h]);
	}
	return 0;
}